package com.dsz.du.mealbooking.model;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class UserModel {
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
	
	@Persistent
	private String userId;
	
	@Persistent
	private String name;
	
	@Persistent
	private String mailAddress;
	
	@Persistent
	private String password;
	
	@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)   
    private List<MealModel> meals = new ArrayList<MealModel>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMailAddress() {
		return mailAddress;
	}

	public void setMailAddress(String mailAddress) {
		this.mailAddress = mailAddress;
	}

	public List<MealModel> getMeals() {
		return meals;
	}

	public void setMeals(List<MealModel> meals) {
		this.meals = meals;
	}


	
	
}
